<template>
  <view class="preview">
    <video id="myVideo" class="preview-video" :src="videoUrl" :autoplay="true" controls />
  </view>
</template>

<script lang="ts" setup>
const videoUrl = ref<string>('');
onLoad((option: any) => {
  videoUrl.value = option.url;
});

onReady(() => {
  const videoContent = uni.createVideoContext('myVideo');
  videoContent.requestFullScreen({ direction: 90 });
  videoContent.play();
});

// 分享
uni.showShareMenu({
  withShareTicket: true,
  menus: ['shareAppMessage', 'shareTimeline'],
});
onShareAppMessage(() => {
  return {
    title: '雨果读书',
    imageUrl: 'https://app5.shuguostar.cn/imgs/images/home/share.png',
  };
});
</script>

<style lang="scss" scoped>
.preview {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 1002;

  .preview-video {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1002;
  }
}
</style>
